//q8.cpp
//This program get an array and a new scheme, setting a new array accordingly.
//
//Binyamin 24 Jan 2018
//----------------------------------------------------------------------------

#include<iostream>

using namespace std;

//no_in
//input: array and it size together with an array of instructions and it size.
//output: a new array with the members of the first array where the location are different
int *not_in(int arr[], int alen, int indices[], int indlen)
{
	bool flag = false;
	int i, j;
	int count;
	int *ret;
	count = 0;
	ret = new int[alen - indlen];
	if(alen == indlen) return NULL;
	for(i=0;i<alen;i++)
	{
		for(j=0;j<indlen;j++)
			if(i == indices[j]) flag = true;
		if(!flag) 
		{
			ret[count] = arr[i];
			count++;
		}
		flag = false;
	}
	return ret;

}
//1. generate test arrays
//2. calculate the new array
//3. print it out
int main()
{
	int arr[] = {2, 3, 14, 11, 14}; // test array
	int ind[] = {2, 0, 3}; // test array
	int i; //looper
	int *arr1; // new array
	arr1 = not_in(arr, 5, ind, 3);
	for(i=0;i<2;i++)
		cout << arr1[i] << '\t';
	cout << endl;
}
